<template>
  <view>
    <view class="hn_i_bnr">
      <image :src="hn_1"></image>
    </view>
    <view :style="'--color:' + color + ';--rgbcolor:' + rgbcolor" class="hn_i_box hnlist">
      <view class="h1">
        专业情感顾问团队
        <text class="b"></text>
      </view>
      <view class="h5">一对一会员服务，提供恋爱、婚姻、个人提升等全方位情感咨询服务</view>
      <view v-if="HNLIST.length > 0">
        <navigator v-for="(item, index) in HNLIST" :key="index" :url="'/hnPages/hn_detail/hn_detail?id=' + item.id" class="li"
                   hoverClass="none">
          <image :src="item.path_url" mode="aspectFill"></image>

          <view class="h2">{{ item.truename }}</view>

          <view class="h4">{{ item.title }}</view>

          <view class="span add">
            <text class="i ico"></text>
            找{{ item.sex_title }}牵线
          </view>
        </navigator>
      </view>
      <view v-else class="nodata">
        <image mode="aspectFit" src="/static/res/img/nodata.png"></image>
        暂无情感顾问
      </view>
    </view>
    <view :style="'--color:' + color + ';--rgbcolor:' + rgbcolor" class="hn_i_box">
      <view class="h1">
        成功牵线案例
        <text class="b"></text>
      </view>
      <view class="h5">定制高端猎婚 • 打造一流服务</view>
      <view v-if="MQE.length > 0" class="iMQEBox">
        <swiper :autoplay="true" :circular="true" :vertical="true" duration="1500" easingFunction="linear"
                interval="3000" style="height: 400rpx">
          <swiper-item v-for="(item, index) in MQE" :key="index" class="iMQE">
            <view v-for="(item2, index1) in MQE[index]" :key="index1" class="li">
              <text class="font">恭喜会员</text>

              <image :src="item2.photo_s" mode="aspectFill"></image>

              <text class="font">{{ item2.uid }}</text>

              <text class="i ico"></text>

              <image :src="item2.photo_s2" mode="aspectFill"></image>

              <text class="font">{{ item2.uid2 }}</text>

              <text class="font">牵线成功</text>
            </view>
          </swiper-item>
        </swiper>
      </view>
      <view v-else class="nodata">
        <image mode="aspectFit" src="/static/res/img/nodata.png"></image>
        暂无案例
      </view>
    </view>
    <view :style="'--color:' + color + ';--rgbcolor:' + rgbcolor" class="hn_i_box ubox">
      <view class="h1">
        线下优质会员
        <text class="b"></text>
      </view>
      <view class="h5">优质线下资源 • 高端约会场所</view>
      <view class="iubtn">
        <view class="a ed" data-sex="0" data-t="offline" @tap="UFn">推荐</view>
        <view class="a" data-sex="1" data-t="offline" @tap="UFn">男嘉宾</view>
        <view class="a" data-sex="2" data-t="offline" @tap="UFn">女嘉宾</view>
      </view>
      <block v-if="U.length > 0">
        <view class="hn_i_u">
          <navigator v-for="(item, index) in U" :key="index" :url="'/pagesA/u/u?uid=' + item.uid" class="a"
                     hoverClass="none">
            <image :src="item.photo_s" class="m" mode="aspectFill"></image>

            <view class="uinfo">
              <view class="data">
                <text class="span">{{ item.D1 }}</text>
                <text class="span">{{ item.D2 }}</text>
              </view>
            </view>

            <image v-if="!globalUtils.empty(item.rzj)" :src="item.rzj" class="rzj" mode="aspectFill"></image>
          </navigator>
        </view>
        <view :style="'--color:' + color" class="hn_i_more" data-sex="0" data-t="offline" @tap="UFn">　更多会员　</view>
      </block>
      <view v-else class="nodata">
        <image mode="aspectFit" src="/static/res/img/nodata.png"></image>
        暂无会员
      </view>
    </view>
    <view :style="'--color:' + color + ';--rgbcolor:' + rgbcolor" class="hn_i_btm" @tap="myhnFn">
      <view class="a">
        <text class="i ico"></text>
        <view class="span">幸福热线</view>
      </view>
      <view class="a">
        <text class="i ico"></text>
        <view class="span">咨询客服</view>
      </view>
      <view class="a">
        <view class="span ico"> 我的顾问</view>
      </view>
    </view>
    <view v-if="hnshow" class="mask3 alpha0_100">
      <view class="div_box big_normal" style="--div_box_width: 70%; --div_box_height: 666rpx">
        <view class="close ico" @tap="kefu_closeFn"></view>
        <view class="truename">{{ HNDETAIL.truename }}</view>
        <view class="id">工号：{{ HNDETAIL.id }}</view>
        <view class="kf_wxpic">
          <image :showMenuByLongpress="true" :src="HNDETAIL.ewm_url"></image>
        </view>
        <view class="kf_text">长按二维码添加客服微信</view>
        <view class="kf_text">咨询情感顾问1对1人工服务</view>
      </view>
    </view>
    <view class="blank"></view>
    <privacy-popup @agree="privacy_agree" @disagree="privacy_disagree"></privacy-popup>
  </view>
</template>

<script>
import privacyPopup from '../../components/privacyPopup/privacyPopup';
import globalUtils from "../../res/www.a9a.cn";

var a = require('../../res/www.a9a.cn.js');
var app = getApp();
var n = uni.getStorageSync('COOK_U');
export default {
  computed: {
    globalUtils() {
      return globalUtils
    }
  },
  components: {
    privacyPopup
  },
  data() {
    return {
      aid: 0,
      hn_1: '',
      color: '',
      rgbcolor: '',
      SHARE: '',
      HNLIST: '',
      MQE: '',
      U: '',
      hnshow: false,

      HNDETAIL: {
        truename: '',
        id: '',
        ewm_url: ''
      }
    };
  },
  onLoad: function () {
    this.onLoadClone3389();
  },
  onShow: function () {
    if (this.aid != app.globalData.aid) {
      this.setData({
        aid: app.globalData.aid
      });
      this.onLoadClone3389({});
    }
  },
  onShareAppMessage: function (a) {
    return {
      imageUrl: this.SHARE.imgurl,
      title: this.SHARE.title,
      path: '/pages/hn/hn?aid=' + app.globalData.aid
    };
  },
  onShareTimeline: function () {
    return {
      imageUrl: this.SHARE.imgurl,
      title: this.SHARE.title,
      query: 'aid=' + app.globalData.aid,
      path: '/pages/hn/hn'
    };
  },
  methods: {
    onLoadClone3389: function () {
      uni.showLoading({
        title: '玩命加载中',
        mask: true
      });
      var that = this;
      a.empty(app.globalData.aid) ||
      that.setData({
        aid: app.globalData.aid
      });

      // app.globalData.get_openid().then(function (e) {
      that.setData({
        hn_1: app.globalData.WWW + '/res/m/img/hn_1.jpg',
        color: app.globalData._ZEAI.color,
        rgbcolor: a.c16_rgb(app.globalData._ZEAI.color)
      });
      n = uni.getStorageSync('COOK_U');
      app.globalData.ajax({
        url: 'hn.php',
        data: {
          submitok: 'hnlist',
          openid: n.openid,
          aid: app.globalData.aid
        },
        success: function (a) {
          if (1 == a.flag) {
            that.setData({
              SHARE: a.SHARE,
              HNLIST: a.HNLIST,
              MQE: a.MQE,
              U: a.U
            });
          } else {
            uni.showToast({
              title: a.msg,
              icon: 'none',
              mask: true
            });
          }
          uni.hideLoading();
        }
      });
      // });
    },

    UFn: function (a) {
      var n = a.currentTarget.dataset.t;
      var i = a.currentTarget.dataset.sex;
      app.globalData.hn_par = {
        t: n,
        sex: i,
        photo_s: 1
      };
      uni.switchTab({
        url: '/pages/user/user'
      });
    },

    hn_detailFn: function (a) {
      var that = this;
      var e = a.currentTarget.dataset.id;
      app.globalData.ajax({
        url: 'hn.php',
        data: {
          submitok: '/hnPages/hn_detail/hn_detail',
          hid: e,
          openid: n.openid
        },
        success: function (a) {
          if (1 == a.flag) {
            that.setData({
              hnshow: true,
              HNDETAIL: a.HNDETAIL
            });
          } else {
            uni.showToast({
              title: a.msg,
              icon: 'none',
              mask: true
            });
          }
        }
      });
    },

    kefu_closeFn: function () {
      this.setData({
        hnshow: false
      });
    },

    myhnFn: function () {
      app.globalData.chklogin().then(function (a) {
        a
            ? uni.navigateTo({
              url: '/myPages/hongniang/hongniang'
            })
            : uni.redirectTo({
              url: '/pages/login/login'
            });
      });
    },

    privacy_agree: function (a) {
      console.log('agree');
    },

    privacy_disagree: function (a) {
      console.log('disagree');
      uni.exitMiniProgram();
    }
  }
};
</script>
<style>
@import './hn.css';
</style>
